import Vue from "vue";
import VueRouter from "vue-router";
import Routers from "./router";
import Vuex from "vuex";
import Util from "./libs/util";

import iView from "iview";
import "./common/reset.css";
import "iview/dist/styles/iview.css";

import App from "./app.vue";
import store from "./store";

import axios from 'axios';
import VueAxios from 'vue-axios';

Vue.use(VueRouter);
Vue.use(Vuex);
Vue.use(iView);
Vue.use(VueAxios, axios);

// 路由配置
const RouterConfig = {
  mode: "history",
  routes: Routers
};
const router = new VueRouter(RouterConfig);

router.beforeEach((to, from, next) => {
  Util.title(to.meta.title);
  next();
});

router.afterEach(() => {
  window.scrollTo(0, 0);
});

new Vue({
  el: "#app",
  router: router,
  store: store,
  render: h => h(App)
});
